using System;
using System.IO;
using EnvDTE;
using Microsoft.VisualStudio.Package;

namespace Agile.VSIX {
    /// <summary>
    /// A class for determining if cleanup can/should occur on specified items.
    /// </summary>
    internal class CodeCleanupAvailabilityLogic {
        #region Internal Methods
        internal static bool CanCleanupProjectItem(ProjectItem projectItem) {
            if(projectItem == null) {
                OutputWindowHelper.DiagnosticWriteLine($"CodeCleanupAvailabilityLogic.CanCleanupProjectItem returned false due to a null project item.");
                return false;
            }
            var projectItemFileName = projectItem.GetFileName();
            if(!projectItem.IsPhysicalFile()) {
                OutputWindowHelper.DiagnosticWriteLine($"CodeCleanupAvailabilityLogic.CanCleanupProjectItem returned false for '{projectItemFileName}' due to the project item not being a physical file.");
                return false;
            }
            return true;
        }
        #endregion Internal Methods
        
    }
}